const Router = require('koa-router');
const router = new Router();
const getUploadToken = require("qiniu");


// 生成七牛上传token
router.post('/common/getUploadToken', async ctx => {
    const accessKey = 'Qv_OXaTQUf1Gi2dvH1Qe77wtLOdMuNMSPCUXzK6j';
    const secretKey = 'pEVQBydHGAZFEmG98ai6UJLL_TsdP-4dd0CxSXNF';
    const mac = new getUploadToken.auth.digest.Mac(accessKey, secretKey);
    const options = {
        scope: 'szcloud',
    };
    const putPolicy = new getUploadToken.rs.PutPolicy(options);
    const uploadToken = putPolicy.uploadToken(mac);
    return ctx.suc('', uploadToken)
})







module.exports = router;